

	<!-- 以下为商家报名主体部分 -->
	<div class="signUp-container">
		<h2>
			<div class="signUp-titL">
				<span>商家报名</span>
				<em>></em>
				<strong><a href="">普通报名</a></strong>		
			</div>
			<div class="signUp-titR">
				<a href="" class="signUp-tit_R">【客服】有问题请联系我们</a>
				<a href="" class="signUp-tit_L">常见问题</a>
			</div>
		</h2>
		<?php $objForm = $this->beginWidget( 'CActiveForm', array('id' => 'SubmitForm')); ?>
			<table>
				<tr>
					<td class="signUp-col-one">
						<label for=""><?php echo GoodsBmModel::model()->getAttributeLabel( 'DetailUrl' ); ?>：</label>
					</td>
					<td class="signUp-col-two">
						<?php  echo $objForm->textField($model, 'DetailUrl', array('name' => 'DetailUrl', 'class' => 'signUp-add signUp-input-common')) ?>
						<a id="getDetail" href="javascript:void(0)">快速获取宝贝链接</a>
					</td>
				</tr>
				<tr>
					<td>
						<label for=""><?php echo GoodsBmModel::model()->getAttributeLabel( 'GoodsName' ); ?>：</label>
					</td>
					<td>
						<?php  echo $objForm->textField($model, 'GoodsName', array('name' => 'GoodsName', 'class' => 'signUp-title signUp-input-common')) ?>
					</td>
				</tr>
				<tr>
					<td>
						<label for=""><?php echo GoodsBmModel::model()->getAttributeLabel( 'ProductID' ); ?>：</label>
					</td>
					<td>
						<?php  echo $objForm->textField($model, 'ProductID', array('name' => 'ProductID', 'class' => 'signUp-title signUp-input-common', 'disabled' => true)) ?>
					</td>
				</tr>
				<tr>
					<td>
						<label for=""><?php echo GoodsBmModel::model()->getAttributeLabel( 'CatID' ); ?>：</label>
					</td>
					<td>
						
						<div id="divselect">
							<?php
							  	$category = CategoryModel::getListTree();

							 if(!empty($model->CatID)){

							?>
								<cite><?php echo $category[$model->CatID] ?></cite>

							<?php }else{ ?>

								<cite>请选择商品分类</cite>
							<?php } ?>
					      <ul>
					      	<?php 
					      	//print_r($category);exit;
					      	foreach($category as $key => $value){  
					      	?>
					      	 <li><a href="javascript:;" selectid="<?php echo $key ?>"><?php echo $value ?></a></li>
					         <?php } ?>
					      </ul>
					  </div>
					  	<?php // echo $objForm->hiddenField($model, 'CatID', array('name' => 'CatID')) ?>
					    <input name="CatID" type="hidden" value="<?php echo $model->CatID ?>" id="inputselect"/>
					</td>
				</tr>
				<tr>
					<td>
						<label for=""><?php echo GoodsBmModel::model()->getAttributeLabel( 'Pprice' ); ?>：</label>
					</td>
					<td>
						<?php  echo $objForm->textField($model, 'Pprice', array('name' => 'Pprice', 'class' => 'signUp-price-common signUp-input-common', 'disabled' => true)) ?>
					</td>
				</tr>
				<tr>
					<td>
						<label for=""><?php echo GoodsBmModel::model()->getAttributeLabel( 'PromoPrice' ); ?>：</label>
					</td>
					<td>
						<?php  echo $objForm->textField($model, 'PromoPrice', array('name' => 'PromoPrice', 'class' => 'signUp-price-common signUp-input-common')) ?>
					</td>
				</tr>
				<tr>
					<td>
						<label for=""><?php echo GoodsBmModel::model()->getAttributeLabel( 'Sales' ); ?>：</label>
					</td>
					<td>
						<?php  echo $objForm->textField($model, 'Sales', array('name' => 'Sales', 'class' => 'signUp-price-common signUp-input-common', 'disabled' => true)) ?>
					</td>
				</tr>
<!-- 				<tr>
					<td>
						<label for=""><?php //echo GoodsBmModel::model()->getAttributeLabel( 'PlanSale' ); ?>：</label>
					</td>
					<td>
						<?php  //echo $objForm->textField($model, 'PlanSale', array('name' => 'PlanSale', 'class' => 'signUp-price-common signUp-input-common')) ?>
					</td>
				</tr> -->
				<tr>
					<td>
						<label for=""><?php echo GoodsBmModel::model()->getAttributeLabel( 'Image' ); ?>：</label>
					</td>
					<td>
						<?php  echo $objForm->textField($model, 'Image', array('name' => 'Image', 'class' => 'signUp-title signUp-input-common')) ?>
					</td>
				</tr>
				<tr>
					<td></td>
					<td>
						<div class="product_img">
							<?php  if(!empty($model->Image)){ ?>
								<img width="160" height="160" src="<?php echo $model->Image; ?>">

							<?php  } ?>
						</div>
					</td>
				</tr>


				
				<tr>
					<td style="vertical-align: top;">
						<label for="" ><?php echo GoodsBmModel::model()->getAttributeLabel( 'Brief' ); ?>：</label>
					</td>
					<td>
						<?php  echo $objForm->textArea($model, 'Brief', array('name' => 'Brief', 'class' => 'signUp-textInp', 'cols' => 30, 'rows' => 10)) ?>

					</td>
				</tr>
				
			</table>
			<div class="signUp-bottom">
				<input name="agree" type="checkbox" id="bg">
				<label for="bg" class="signUp-bg" id="signUpBg"></label>
				<span>我已经认真阅读并同意妈咪街《商家报名规则》<em style="font-size:12px;color:#ff97ae;">妈咪街商家QQ群：424071021,195032206</em></span>
				<button>提交报名</button>
			</div>
		<?php $this->endWidget(); ?>
		
		
	</div>
	<script src="<?php  echo yii::app()->theme->baseUrl ?>/assets/js/jquery.js"></script>
	<script src="<?php  echo yii::app()->theme->baseUrl ?>/assets/js/divselect.js"></script>
	<script>
		$.divselect("#divselect","#inputselect");
		var signUpBg = document.getElementById('signUpBg'),
			bg = document.getElementById('bg'),
			change = true;
		bg.onclick = function() {
			if(change) {
				signUpBg.style.background = "url(<?php  echo yii::app()->theme->baseUrl ?>/assets/images/" + "indi_icon.png)";
				change = false;
			} else {
				signUpBg.style.background = "url(<?php  echo yii::app()->theme->baseUrl ?>/assets/images/" + "indi_icon_off.png)";
				change = true;
			}
		}

		$("input").focus(function() {
			$(".signUp-textInp").css({
				"border" : "none"
			})
			$("form input").css({
				"border" : "none"
			});
			$(this).css({
				"border" : "1px solid #ff97ae"
			});
		});

		$(".signUp-textInp").focus(function() {
			$("form input").css({
				"border" : "none"
			});
			$(".signUp-textInp").css({
				"border" : "1px solid #ff97ae"
			});
		})
	</script>

  <script type="text/javascript">
    $("#getDetail").click(function(e){
      e.preventDefault();
      var url = $("#DetailUrl").val();
      $.post('/front/public/taoData', {url:url}, function(data){
        console.log(data);
        if(data.status){
            //图片
            var imgstr = '';
            if (data.images) {
                $.each(data.images, function(i, v) {
                  if(i == 0 && '<?php echo ACTION_NAME ?>' == 'create'){
                    $("#Image").val(v);
                  }
                  imgstr += '<img  width="160" height="160"  src=' + v + ' />';
                });
                $('div.product_img').html(imgstr);
                product_img();
            }
            $("#DetailUrl").val(data.detail_url);
            $("#GoodsName").val(data.title);
            $("#ItemType").val(data.item_type);
            $("#Nick").val(data.nick); 
            $("#Pprice").val(data.p_price); 
            $("#ProductID").val(data.product_id); 
            $("#PromoPrice").val(data.promo_price); 
            $("#Sales").val(data.sales); 
        }
      }, 'json');      
    })

    function product_img() {
        $('div.product_img img').click(function() {
            $('div.product_img img').removeClass('current');
            $(this).addClass('current');
            $('#Image').val(this.src);
        });
    }

  </script>


    <script src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/statics/js/ajaxForm.js"></script> 
  <link rel="stylesheet" href="<?php echo yii::app()->theme->baseUrl;  ?>/assets/statics/js/artDialog/skins/blue.css">
  <script src="<?php echo yii::app()->theme->baseUrl;  ?>/assets/statics/js/artDialog/artDialog.js"></script> 

  <script type="text/javascript">
	$(function(){
		var LOCK = false;

		$('#SubmitForm').ajaxForm({
			dataType:'json',		
			beforeSubmit:function(data, obj, es){
				if(LOCK){
					alert('正在处理');
					return false;
				}		
			},
			success:function(data){
				LOCK = false;
				if(data.status){
					alert('提交成功');	
					if(data.url){
						window.location.href = data.url;					
					}					
				}else{
					alert(data.info);					
				}
			}
		});

	})
  </script>
